for i in range(int(input())):
flag=0
s=input()
c=input()
for i in range(len(s)):
if s[i]==c and (i+1)%2!=0:
flag=1
if flag==1:
print("YES")
else:
print("NO")
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define improve ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
#define ll long long
#define el '\n'
using namespace std;
bool cmp(pair < ll, ll > x, pair<ll, ll>y)
{
return x.second > y.second;
}
vector<int> pre(vector<int>arr)
{
vector<int>prefix(arr.size() + 1, 0);
for (int i = 1; i < prefix.size(); i++)
{
prefix[i] = prefix[i - 1]+ arr[i-1];
}
return prefix;
}
vector<int> suf(vector<int>arr)
{
vector <int>suffix(arr.size() + 1, 0);
for (int i = arr.size() - 1; i >= 0; i--)
{
suffix[i] = suffix[i + 1] + arr[i];
}
return suffix;
}
int max_mod(int x, int y) {
return y ? max_mod(y, x % y) : x;
}
int main()
{
improve;
ll n; cin >> n;
while (n--)
{
string name; cin >> name;
char temp; cin >> temp;
bool flag = false;
for (int i = 0; i < name.size(); i++)
{
if (temp == name[i] && (i % 2 == 0))
{
flag = true;
break;
}
}
if (flag)
cout << "YES" << el;
else
cout << "NO" << el;
}
return 0;
}
1004B - Sonya and Exhibition | 1397A - Juggling Letters |
985C - Liebig's Barrels | 115A - Party |
746B - Decoding | 1424G - Years |
1663A - Who Tested | 1073B - Vasya and Books |
195B - After Training | 455A - Boredom |
1099A - Snowball | 1651D - Nearest Excluded Points |
599A - Patrick and Shopping | 237A - Free Cash |
1615B - And It's Non-Zero | 1619E - MEX and Increments |
34B - Sale | 1436A - Reorder |
1363C - Game On Leaves | 1373C - Pluses and Minuses |
1173B - Nauuo and Chess | 318B - Strings of Power |
1625A - Ancient Civilization | 864A - Fair Game |
1663B - Mike's Sequence | 448A - Rewards |
1622A - Construct a Rectangle | 1620A - Equal or Not Equal |
1517A - Sum of 2050 | 620A - Professor GukiZ's Robot |